dnl	$OpenBSD: install,v 1.28 2013/12/04 23:20:19 jmc Exp $
OpenBSDInstallPrelude

OpenBSD is installed on the Zaurus by effectively converting
Linux into a bootloader.  This can be done easily by installing
a package from Qtopia, or manually from a terminal.  Both ways
are described below, the easy one first.

The package takes care of modifying the Linux startup files for
you as necessary.  To protect you from a common pitfall, ext3
filesystems mounted on /hdd[12] are converted back to ext2.

(That way a fatal error in Linux startup scripts is avoided when
the journal has been destroyed by mounting one of the ext3
filesystems as ext2 on OpenBSD).

1. Press "Home" until the second icon tab is selected (Settings).
2. Open the "Add/Remove Software" dialog.  That's the green icon
   with an arrow pointing from left to right into a rectangle.
3. Press "Install packages via networks", the middle one of the
   three big buttons.  The "Package Manager" dialog pops up.
4. Press the yellow switch icon in the lower right corner to
   bring up the "Package Servers" dialog.
5. Press the left button, which is labeled "New" if your Zaurus
   is in English, enter the HTTP/FTP URL of the nearest OpenBSD
   mirror, and change the field above the URL into a name for
   that server.  Press the "OK" button in the upper right corner
   to return to the "Package Manager" dialog.
6. Press the "Upgrade" button in the lower left corner to update
   the package index if that was not done automatically.  A
   package named "openbsd" should appear in the package list.
   Select this package and press the question mark icon in the
   lower right corner.
7. Now you see the package details and three buttons, labeled
   "Install", "Remove", and "Ignore" in this order.  Press the
   leftmost button and twice "OK" to finish the installation.
   Then close the "Add/Remove Software" dialog.
8. Activate the "Q" menu in the lower left corner of the screen
   and choose "Reboot" (that's the item with a green icon next
   to it, above the power-off icon).  Wait for the system to
   reboot.  At the boot> prompt, hit enter to boot OpenBSD, or
   type 'r' to boot Linux.  Since you want to install OpenBSD,
   this time you will want to type 'r'.
9. Wait while Linux is coming up, then switch to the first tab
   (Applications), scroll down, and press the icon which is
   labeled "Install OpenBSD".  A few seconds later, an OpenBSD
   bsd.rd will boot on your Zaurus, so that you can perform the
   standard install process.

Another way to install the package is from a shell.  You will
need the following file from the distribution on the Zaurus:

	openbsd{:--:}OSrev{:--:}_arm.ipk

Perform the following operation as root to install the package,
and then continue as in step 8, above:

	{:-#-:} ipkg install openbsd{:--:}OSrev{:--:}_arm.ipk

To install the OpenBSD boot program manually, you will need the
following files from the distribution:

	zbsdmod.o
	zboot
	bsd.rd

After starting up some sort of terminal emulator on the Zaurus
and becoming root, perform the following operation:

	# insmod zbsdmod.o
	# cp bsd.rd /proc/zboot

A few seconds later, OpenBSD will boot on your Zaurus.

If you already have a bsd.rd or bsd kernel contained in a FFS
partition on the C3x00 hard drive, you can instead use 

	# insmod zbsdmod.o
	# ./zboot

OpenBSDInstallPart2

OpenBSDInstallPart3(,"wd0")

OpenBSDInstallPart4

OpenBSDInstallMBRPart1

	One of the three partitions on the Zaurus C3x00 hard drive is
	a 3GB or 5GB MS-DOS filesystem.  This partition has application
	and user data on it and can be a lot smaller.  It is therefore
	recommended that you cut most of the space off this large MS-DOS
	partition, and create a new A6 partition afterwards, like this:

 0: 83    0   3 13 - 1511   7 17 [          63:      205569 ] Linux files*
 1: 83 1512   0  1 - 7559   7 17 [      205632:      822528 ] Linux files*
 2: 0C 7560   0  1 - 9065   7  1 [     1028160:      204800 ] Win95 FAT32L
 3: A6 9065   7  2 - 67885  5  3 [     1232960:     7999488 ] OpenBSD     

	After shrinking the MS-DOS partition, you will need to
	reformat it from Linux or OpenBSD once OpenBSD is installed.
	(You will be reminded of this later in this document)

OpenBSDInstallMBRPart2

OpenBSDInstallPart5({:-
	If you have Linux partitions defined on the disk, these will
	usually show up as partition 'i', 'j' and so on.-:})

OpenBSDInstallPart6({:-CD-ROM, -:})

OpenBSDURLInstall

OpenBSDCDROMInstall

OpenBSDDISKInstall({:-"wdN" or -:},,{:-, Linux (ext2) or MS-DOS-:})

OpenBSDCommonInstall

OpenBSDInstallWrapup

OpenBSDCongratulations

	If you have kept the MS-DOS partition, do not forget to
	newfs it using:

		newfs -t msdos /dev/rwd0k

	This should be done before attempting to mount and use this
	partition from Linux or OpenBSD.

	For purposes of recovery in case Linux becomes inoperable for
	one reason or another with HDD1 Errors and such, we detail the
	process to come up single user:

		Remove power and the battery.
		Begin holding down the 'b' and 'd' keys.
		Wait for 1 minute.
		Insert battery and power on unit.
		As soon as a login screen starts to show up, release the 'b'
		and 'd' keys.
		Login as root.

	The following sequence is also recommended inside Linux so that
	problems will happen less often.  By default the boot scripts fail
	if the MS-DOS partition is corrupt in any way.  If you are already
	root do the following, which will skip mounting the MS-DOS partition.

		Login as root.

		Find the rc.rofilesys file.  It is either in
		/root/etc/rc.d

			cd /root/home/etc/rc.d

		Or you have to mount it using:

			mount /dev/mtdblock2 /mnt
			cd /mnt/home/etc/rc.d

		cat rc.rofilesys | sed -e '/vfat/s/^/#/' > vfat
		diff -u rc.rofilesys vfat		# to double check
		cp rc.rofilesys rc.rofilesys.vfat
		cp vfat rc.rofilesys
		
	In these cases below we avoid using vi because Linux quality is of
	such high caliber that vi locks up the console.  If you logged in
	multiuser you may be able to use vi.

	Please be aware that if you fsck the two Linux partitions on
	the disk, they are actually ext3fs partitions and you will thereby
	corrupt their journals.  This will make them into ext2fs partitions.
	Linux will not be able to boot, and you will need to use the
	processes below to get to the point where Linux will mount them as
	ext2fs partitions:

		Login as root.

		Find the rc.rofilesys file.  It is either in
		/root/etc/rc.d

			cd /root/home/etc/rc.d

		Or you have to mount it using:

			mount /dev/mtdblock2 /mnt
			cd /mnt/home/etc/rc.d

		cat rc.rofilesys | sed -e '/^LINUXFMT=ext3$/s/^/#/' \
			-e '/^#LINUXFMT=ext2$/s/^#//' > ext2
		diff -u rc.rofilesys ext2		# to double check
		cp rc.rofilesys rc.rofilesys.ext3
		cp ext2 rc.rofilesys



OpenBSDUnattendedInstallation
